<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>渠道管理 - 商品分类规格</title>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">商品分类规格</h3>
        <ul class="page-breadcrumb breadcrumb">
       
          <li class="btn-group">
          </li>
         
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 渠道管理 <i class="icon-angle-right"></i> </li>
          <li>商品分类规格</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
        <p style="color:red ">  (注意：存在多规格时，只能对一个规格的所有值设置图片。例如商品有两个规格：颜色（红色，蓝色）和容量（100ml，200ml），则只需要上传红色和蓝色两个值对应的图片即可，不要再上传100ml和200ml的图。)</p>
    </div>

    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    <form action="specdo" method="post" enctype="multipart/form-data">
    <input type="hidden" name="act" value="sevaGoodSpecsPic">
     <input type="hidden" name="goods_id" value="<?=$_GET['goods_id']?>">
     <input type="hidden" name="cate_id" value="<?=$_GET['cate_id']?>">
    <div class="row">
      <div class="col-md-6"> 
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"><i class="icon-reorder"></i>列表
               </div>
            <div class="tools"> <a href="javascript:;" class="collapse"></a> </div>
          </div>
          <div class="portlet-body">
            <table class="table table-hover">
              <thead>
                <tr>
                  <th>名称</th>
                  <th>状态</th>
                  <th>图片</th>                  
                </tr>
              </thead>
              <?php
    			  if($this->data[0]){
    				foreach($this->data[0] as $k=>$r){
    					?>	
                    <tbody>
                    <tr class="note note-info">                    
                    <td><?=$r['name'];?></td>
                    <td><?=$this->c['stat']['normal'][$r['stat']];?></td>
                    <td>
                        
                    </td>
                    </tr>
                    <?php
        					if($this->data[$r['caid']]){
        						foreach($this->data[$r['caid']] as $j=>$s){
        							if($r['stat']>1) $s['stat'] = $r['stat'];
        						?>
                        <tr>
                        <td style="padding-left:30px;"><?=$s['name'];?></td>
                        <td><?=$this->c['stat']['normal'][$s['stat']];?></td>
                        <td>
                        
                     <div class="form-group">
                        <input  name="spec_id[]" type="hidden" value="<?=$s['caid']?>">
                        <div class="col-md-9">
                          <input  name="pic[]" type="file" >
                          <p class="help-block">只允许上传JPG图片，2M以内</p>
                          <?php if($s['pic_path'] !="" ){?>
                          <p>图片已经存在，<a href="<?=$s['pic_path'];?>" target="_blank">点击查看&gt;&gt;</a></p>
                              <p><a href="javascript:_del(<?=$s['pic_id'];?>)">删除&gt;&gt;</a></p>
            						  <?
            						  }
            						  ?>
                        </div>
                      </div>
                        </td>
                        </tr>
                        <?	
						}
					}?>
                    	
                    
                    </tbody>
                <?
				}
			  }
			  ?>
            </table>
          </div>
        </div>
        <!-- END SAMPLE TABLE PORTLET--> 
      </div>
    </div>
                        <div class="form-actions fluid">
                      <div class="col-md-offset-3 col-md-9">
                        <button type="submit" class="btn blue">提交</button>
                      </div>
                    </div>
    </form>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->
    <!-- /.modal --> 
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script>
    jQuery(document).ready(function() {    
       App.init();
    });

    function _del(id=0){

        if(id>0){

            var  cm = confirm("您确定要删除吗？");
            if(cm){

                $.post("/channel/ajax",
                    {
                        "act":"del_pic",
                        "id":id,
                        "mr":Math.random()
                    },
                    function(json){
                        if(json.code==200)
                        {
                            swal("保存成功",false,"success");
                            window.location.reload();

                        }
                        else{
                            swal(json.msg,"错误代码["+json.code+"]","error");
                        }

                    },"json");
            }


        }



    }


  </script> 
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>